﻿@using KL.Store.Core
@model KL.Store.Web.Models.WishListsModel
<div class="content">
    <div class="breadcrumb col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="bcBorder"></div>
        <div class="bcLinks">
            <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
                <a href="/" itemprop="url">
                    <span itemprop="title">Anasayfa</span>
                </a>›
            </div>
            <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
                <a href="/WishLists/Index" itemprop="url">
                    <span itemprop="title">Listelerim</span>
                </a>
            </div>
        </div>
        <div class="bcBorder"></div>
    </div>
    <div class="clearfix"></div>
    <h1>Listelerim</h1>
    @if (Model.WishLists.Count > 0)
    {    
        <div class="cart-info">
            <div class="shop-cart-wishlists">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <td class="name col-xs-2">Ad Soyad
                            </td>
                            <td class="name col-xs-6">Liste Adı
                            </td>
                            <td class="name col-xs-2">Yapıldığı Tarih
                            </td>
                            <td class="quantity col-xs-2" style="border-right: none;">Ürünler
                            </td>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.WishLists)
                        {
                            <tr>
                                <td class="name">
                                    <a id="pl_@item.ListId" class="lstLink" href="/WishList/Index/@(item.ListId.ToString())">@(item.FirstName)
                                        @(item.LastName)</a>
                                </td>
                                <td class="name">
                                    @item.ListName
                                </td>
                                <td class="name">
                                    @item.CreateDate
                                </td>
                                <td style="border-right: 0;">
                                    <div class="left">
                                        <a class="button-cont-right" href="/WishList/ListDetail/@item.ListId"><span>@item.ItemCount</span></a>
                                    </div>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    }
    else
    {
        <div class="bg-info bs-bgb" style="margin-bottom: 15px; color: #000000;">
            <span class="glyphicon glyphicon-info-sign"></span>&nbsp;Henüz hiç liste eklenmemiş.
        </div>
    }
    <a href="/WishList/Index" class="btn btn-custom1 right"><span>Yeni Liste Oluştur</span></a>
    <div class="clearfix"></div>
</div>
<script type="text/javascript">
    $('a.cgLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Categories/Get', { id: qsId });
        return false;
    });
    $('a.prLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Products/Get', { id: qsId });
        return false;
    });

    $('a.prdLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Product/Get', { id: qsId });
        return false;
    });

    $('a.rmLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Cart/Remove', { id: qsId }, function () { RefreshCartSummary(); });
        return false;
    });

    $('a.upLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        var qty = $('#qty_' + qsId.toString()).val();
        $('#content').load('/Cart/Update', { 'id': qsId, 'qty': qty }, function () { RefreshCartSummary(); });
        return false;
    });

    function RefreshCartSummary() {
        $('#cart').load('/Cart/GetSummary', {});
    }
</script>
